import { View,Image } from '@tarojs/components'
import React from 'react'
import './index.scss'

export default function InputNumber(props) {
  const {value,onCut,onAdd,maxValue} = props
  return (
    <View className='sinyu-input-number'>
      {value > 0?<>
        <Image onClick={()=>{ onCut() }} className='cut-img' src={require('@/images/common/cut.svg')} mode='widthFix' />
        <View className='input'>{value}</View>
        <Image onClick={()=>{
          if(maxValue && value >= maxValue) return;
          onAdd(value)
        }} src={require('@/images/common/add.svg')} className='add-img' mode='widthFix' />
      </>:
      <Image onClick={()=>{
        onAdd(value)
      }} src={require('@/images/common/add.svg')} className='add-img' mode='widthFix' />}
    </View>
  )
}
